﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Style TargetType="{x:Type TextBox}">
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
                <Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
                <Setter Property="Opacity" Value="1.0"/>
            </Trigger>
        </Style.Triggers>
        <Setter Property="Template" Value="{DynamicResource TextBoxTemplate}" />
    </Style>
    
    <ControlTemplate x:Key="TextBoxTemplate" TargetType="{x:Type TextBox}">
        <Grid>
            <Border x:Name="BorderBase" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0" />
            <Border x:Name="Over" BorderBrush="{DynamicResource FocusBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0" Opacity="0" />
            <Border x:Name="Over_Border" Margin="-1" BorderBrush="{DynamicResource MouseOverHighlightBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0" IsHitTestVisible="False" Opacity="0" />
            <ScrollViewer Margin="0" x:Name="PART_ContentHost" Foreground="{DynamicResource OutsideFontColor}" />
            <Border x:Name="DisabledVisualElement" Background="#A5FFFFFF" BorderBrush="#59C0C0C0" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0" IsHitTestVisible="False" Visibility="Collapsed" />
            <Border x:Name="ReadOnlyVisualElement" Background="#66FFFFFF" CornerRadius="0" Visibility="Collapsed" />
            <Border x:Name="FocusVisualElement" BorderBrush="#FFB1703C" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0" IsHitTestVisible="False" Opacity="0" />

        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsFocused" Value="True">
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="True" />
                    <Condition Property="IsFocused" Value="False" />
                </MultiTrigger.Conditions>
            </MultiTrigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
                <Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="True">
                <Setter Property="Foreground" Value="#FF000000" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
</ResourceDictionary>